import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/storage'
// VueX(获取方便，响应式) + localStorage(持久化)

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        // 存储用户登录信息
        user: getItem('TOUTIAO_USER')
    },
    mutations: {
        setUser (state, data) {
            state.user = data
            setItem('TOUTIAO_USER', state.user)
        }
    },
    actions: {
    },
    modules: {
    }
})
